package com.bilibili.service.impl;

import java.util.List;

import com.bilibili.dao.UserDao;
import com.bilibili.dao.VideoInfoDao;
import com.bilibili.dao.impl.UserDaoImpl;
import com.bilibili.dao.impl.VideoInfoDaoImpl;
import com.bilibili.dto.VideoInfo;
import com.bilibili.entity.Page;
import com.bilibili.service.VideoInfoService;

public class VideoInfoServiceImpl implements VideoInfoService {

	VideoInfoDao vd = new VideoInfoDaoImpl();
	UserDao ud = new UserDaoImpl();	
	@Override
	public Page<VideoInfo> selectAllNotVideoR(VideoInfo v, int pageNum, int pageSize) {
		// TODO Auto-generated method stub
		List<VideoInfo> videoInfoList = vd.selectAllNotVideoR(v, pageNum, pageSize);
		for (VideoInfo vi : videoInfoList) {
			vi.setUsername(ud.selectUserNameById(vi.getUploaderId()));
		}
		int totalRows = vd.selectAllNotVideoRNum(v);
		Page<VideoInfo> videoInfoPage = new Page<VideoInfo>(videoInfoList,pageNum,pageSize,totalRows);
		return videoInfoPage;
	}
}
